home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Magnum One
/
Magnum One (Mid-American Digital) (Disc Manufacturing).iso
/
d15
/
icondll.arc
/
ICONDLL.C
next >
Wrap
C/C++ Source or Header
|
1990-09-18
|
1KB
|
68 lines
#include <dos.h>
#include <io.h>
#include <process.h>
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
void main(int argc, char *argv[])
{
char tempname[14];
FILE *tempfile;
struct find_t fileinfo;
char str[40];
int i=0;
int DeleteFlag;
printf("ICONDLL - Combines *.ICO files into a .DLL file.\n");
printf("Copyright (c) 1990, James M. Curran.\n");
if (argc > 1)
DeleteFlag= (int) strchr(strupr(argv[1]),'D');
strcpy(tempname,"ICXXXXXX");
if ( (mktemp(tempname)) == NULL) {
printf("Cannot create temporary file.\n");
exit(1);
}
strcat(tempname,".RC");
if (_dos_findfirst("*.ICO", _A_NORMAL, &fileinfo)==0) {
tempfile=fopen(tempname,"wt");
do {
sprintf(str,"%d\tICON\t%s\n",++i,fileinfo.name);
fwrite(str,sizeof(char),strlen(str),tempfile);
} while (_dos_findnext(&fileinfo)==0);
}
else {
printf("No .ICO files found in this directory.\n");
exit(2);
}
fclose(tempfile);
system("COPY iconstub.exe icons.dll");
errno=0;
if(spawnlp(P_WAIT,"rc","RC.EXE", tempname,"icons.dll",NULL)==-1){
perror(NULL);
printf("Could not run RC.exe.");
}
if (DeleteFlag)
remove(tempname);
tempname[strlen(tempname)-1]=0;
strcat(tempname,"ES");
remove(tempname);
exit(0);
}